<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .component-btn {
           width: 400px;
           height: 200px;
           text-align: center;
           vertical-align: middle;
           position: relative;
        }

        .component-btn .btn {
            width: 100%;
            height: 100%;
            background-color: transparent;
            border: none;
            outline: none;
        }

        .component-btn .top,
        .component-btn .left,
        .component-btn .right,
        .component-btn .bottom {
            position: absolute;
            display: inline-block;
            background-color: red;
            margin: auto;
            transition: width 2s, height 2s;
        }

        .component-btn:hover .top,
        .component-btn:hover .bottom {
            width: 400px;
        }

        .component-btn:hover .left,
        .component-btn:hover .right {
            height: 200px;
        }

        .component-btn .top {
            top: 0;
            left: 0;
            right: 0;
            margin: 0 auto;
            width: 0px;
            height: 1px;
            
        }

        .component-btn .left {
            top: 0;
            bottom: 0;
            left: 0;
            width: 1px;
            height: 0px;
        }
        .component-btn .bottom {
            top: 200px;
            left: 0;
            right: 0;
            width: 0px;
            height: 1px;
            
        }

        .component-btn .right {
            top: 0;
            bottom: 0;
            left: 400px;
            width: 1px;
            height: 0px;
        }
    </style>
</head>
<body>
    <div class="component-btn">
        <button class="btn">按钮</button>
        <span class="top"></span>
        <span class="left"></span>
        <span class="right"></span>
        <span class="bottom"></span>
    </div>

</body>
</html>